package com.tbs.parkingsaleapp.UI.Listenners;

import android.widget.*;
import com.tbs.parkingsaleapp.Http.JsonData.ParkResult;
import com.tbs.parkingsaleapp.SystemManager.SystemDataMananger;
import com.tbs.parkingsaleapp.UI.HomePage.HomeFragment;
import com.tbs.parkingsaleapp.UI.HomePage.MarkerClickData;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;

import java.util.ArrayList;

public class InfoWindowClicker implements TencentMap.OnInfoWindowClickListener {


    HomeFragment fg;
    public InfoWindowClicker(HomeFragment fragment)
    {
        this.fg=fragment;
    }
    @Override
    public void onInfoWindowClick(Marker marker) {

        MarkerClickData info= (MarkerClickData) marker.getTag();

        ArrayList<ParkResult> res=SystemDataMananger.FindAllParks(info.getId());
        if(info.isClickable())
        {
            fg.Show(SystemDataMananger.FindLocation(info.getId()));
        }
        else
        {
            Toast.makeText(fg.getContext(),"正在更新数据中，请稍后",Toast.LENGTH_SHORT).show();
        }

    }

    @Override
    public void onInfoWindowClickLocation(int i, int i1, int i2, int i3) {

    }
}
